<div class="bjui-pageHeader">
<form id="pagerForm" data-toggle="ajaxsearch" action="__URL__" method="get">
	<input type="hidden" name="pageSize" value="{$numPerPage}">
    <input type="hidden" name="pageCurrent" value="{$_REQUEST['pageNum']|default=1}">
        <div class="bjui-searchBar">
			<label>时间：</label><input type='text' data-toggle='datepicker' value='{$_REQUEST['time1']}' name='time1' class='form-control' size='12' />-<input type='text' data-toggle='datepicker' value='{$_REQUEST['time2']}' name='time2' class='form-control' size='12' />&nbsp;<label>产品分类：</label><select name='fenlei' data-toggle='selectpicker'><option value=''>全部</option><foreach name='fenleilist' item='v'><option value='{$v.fenlei}'  <if condition="$v.fenlei EQ $_REQUEST['fenlei']">selected<else/>{$_REQUEST['fenlei']}</if> >{$v.fenlei}</option></foreach></select>&nbsp;
             <button type="submit"  class="btn-default" data-icon="search">查询</button>
             <a class="btn btn-orange" href="javascript:;" onclick="$(this).navtab('reloadForm', true);" data-icon="undo">清空查询</a>
			 <php>if(display(CONTROLLER_NAME.'/dayin')){</php><span style="float:right;margin-right:5px;"><a href="{:U('tjchanpin/dayin',array('time1'=>$_REQUEST['time1'],'time2'=>$_REQUEST['time2'],'fenlei'=>$_REQUEST['fenlei']))}" target="_blank" class="btn btn-blue" data-icon="print">打印</a></span><php>}</php>
		</div> 
</form>
    
</div>
<div class="bjui-pageContent tableContent">
     <table data-toggle="tablefixed" data-width="100%" data-layout-h="0" data-nowrap="true">
            <thead>
                <tr>
                    <th rowspan="2" data-order-field="id">ID</th>
                    <th rowspan="2" data-order-direction='desc' data-order-field='bianhao'>产品编号</th>
<th rowspan="2">产品名称</th>
<th rowspan="2">产品分类</th>
<th rowspan="2">产品规格</th>
<th rowspan="2">计量单位</th>
                <th colspan="3" align="center">{$_REQUEST['time1']}-{$_REQUEST['time2']}统计</th>
                </tr>
                <tr>
                    <th>入库</th>
                    <th>出库</th>
					<th  data-order-direction='desc' data-order-field='kucun'>库存</th>
                </tr>
            </thead>
            <tbody>
                <volist id="v" name="list">
          <tr>
<td>{$v.id}</td>
<td>{$v.bianhao}</td>
<td>{$v.title|msubstr=###,0,20}</td>
<td>{$v.fenlei|msubstr=###,0,20}</td>
<td>{$v.type|msubstr=###,0,20}</td>
<td>{$v.danwei|msubstr=###,0,20}</td>
<td>
<php>
if(isset($_REQUEST['time1']) && $_REQUEST['time1'] != ''&&isset($_REQUEST['time2']) && $_REQUEST['time2'] != ''){ $map['shijian'] =array(array('egt',I('time1').' 00:00:00'),array('elt',I('time2').' 59:59:59'));}
$where['bianhao']=array("eq",$v['bianhao']);
$map['_complex'] = $where;
echo M('rukus')->where($map)->sum('shuliang');
$where="";
$map="";
</php>
</td>
<td>
<php>
if(isset($_REQUEST['time1']) && $_REQUEST['time1'] != ''&&isset($_REQUEST['time2']) && $_REQUEST['time2'] != ''){ $map['shijian'] =array(array('egt',I('time1').' 00:00:00'),array('elt',I('time2').' 59:59:59'));}
$where['bianhao']=array("eq",$v['bianhao']);
$map['_complex'] = $where;
echo M('chukus')->where($map)->sum('shuliang');
$where="";
$map="";
</php>
</td>
<td>{$v.kucun}</td>
         </tr> 
          </volist>
            </tbody>
        </table>
				  
</div>
<div class="bjui-pageFooter">
    <ul>
       <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
    </ul>
</div>